home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.19970626-19970929 / 000342_news@newsmaster….columbia.edu _Thu Sep 11 10:37:40 1997.msg < prev    next >
Internet Message Format  |  2020-01-01  |  4KB

  1. Return-Path: <news@newsmaster.cc.columbia.edu>
  2. Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.35.30])
  3.     by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id KAA25381
  4.     for <kermit.misc@watsun.cc.columbia.edu>; Thu, 11 Sep 1997 10:37:38 -0400 (EDT)
  5. Received: (from news@localhost)
  6.     by newsmaster.cc.columbia.edu (8.8.5/8.8.5) id KAA29879
  7.     for kermit.misc@watsun; Thu, 11 Sep 1997 10:37:38 -0400 (EDT)
  8. Path: news.columbia.edu!watsun.cc.columbia.edu!fdc
  9. From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
  10. Newsgroups: comp.protocols.kermit.misc
  11. Subject: Re: MSDOS Kermit to Kermit/2..
  12. Date: 11 Sep 1997 14:37:36 GMT
  13. Organization: Columbia University
  14. Lines: 76
  15. Message-ID: <5v8vng$sml$1@apakabar.cc.columbia.edu>
  16. References: <TCPSMTP.17.9.11.0.45.8.2375661496.4684067@kincyb.com>
  17. NNTP-Posting-Host: watsun.cc.columbia.edu
  18. Xref: news.columbia.edu comp.protocols.kermit.misc:7664
  19.  
  20. In article <TCPSMTP.17.9.11.0.45.8.2375661496.4684067@kincyb.com>,
  21.  <dallasii@kincyb.com> wrote:
  22. : ...
  23. : Here is what I found to work, when the .CMD file is both in the
  24. : path, or the current directory:
  25. : EXTPROC D:\K2\K2.EXE 
  26. : ; C:\USR\COMM\Ktest7.CMD
  27. : echo \&@[0] \&@[1] \&@[2] \&@[3] ... (etc)
  28. : IF DEFINED \&@[2] ASSIGN \%1 \&@[2] 
  29. : IF DEFINED \&@[3] ASSIGN \%2 \&@[3]
  30. : IF DEFINED \&@[4] ASSIGN \%3 \&@[4]
  31. : echo \%1 \%2  \%3 \%4 \7 \7 \7 \7 \7 the input
  32. : echo Ktest7!\13\10
  33. : EXIT
  34. : then I type:
  35. : ktest7 a b c d e f g 
  36. : which output:
  37. :
  38. : D:  KTEST7.CMD  a b c d e f g
  39. : a b c the input
  40. : Ktest7!
  41. : This is acceptable to me.
  42. : Does it seem like I'm clear on the concept?
  43. Yup.  You can also do the same with a loop:
  44.  
  45. for \%i 0 \fmin(\v(args),9) 1 {
  46.    _assign \\%\%i \&@[\%i]
  47. }
  48.  
  49. Although documented in the manual, this might be a bit obscure.  It
  50. illustrates the use of the \v(args) variable (number of command-line words)
  51. and of the _ASSIGN command (note leading underscore), in which the name of
  52. the variable to be assigned is not taken literally (as it is with ASSIGN),
  53. but evaluated and constructed first, so when \%i is 0, this statement
  54. assigns the value of \&@[0] (command-line argument number 0 -- "argv[0] to
  55. C programmers) to the variable \%0, etc.  "\fmin(\v(args),9)" ensures that
  56. we don't go above 9, since \%9 is the highest \%<number> variable.
  57.  
  58. : My goal is to make some command file scripts executable in several OS's
  59. : on my machine in as many ways as possible, with just one file holding the
  60. : script - various flavors of DOS and DOS Emulators, OS/2 and LINUX
  61. : C-Kermit from within the appropriate version of Kermit.
  62. :
  63. If you want to run a Kermit script from system command level, i.e. without
  64. starting Kermit first, it has to follow the syntax rules of the underlying
  65. platform or shell.  Thus EXTPROC in OS/2 gives approximately the same
  66. effect as #!/pathname in UNIX, but there is no analogous mechanism in DOS.
  67. Unfortunately, I don't think there is a way to make the first line of the
  68. Kermit script compatible with both.
  69.  
  70. As Jeff pointed out, you can:
  71.  
  72.   define extproc comment
  73.  
  74. in any version of Kermit at all.  If EXTRPOC is a built-in command (as it
  75. is in the OS/2 version), it will take precedence over the macro definition,
  76. as built-in commands always do; otherwise EXTPROC statements will be
  77. treated as comments.  Well, they are even in OS/2, at least by Kermit itself.
  78.  
  79. Once you get past the first line, it is easy to write portable scripts
  80. by testing the \v(platform), \v(program), \v(system), and other intrinsic
  81. variables, as well as using \$(XXXX) to test or import environment variables.
  82.  
  83. : Again, much thanks - you guys have unbelievable patience.
  84. Thanks for the detailed report.  I hope this newsgroup proves as valuable to
  85. Kermit users as it is to us in helping us to refine our documentation,
  86. help-desk procedures, etc, and in deciding how to prioritize our infinitely
  87. long list of things to do.
  88.  
  89. - Frank